using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Pub_Module_J_MostProduct1 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            BindData();
    }
    private void BindData()
    {
        string viewcount = System.Configuration.ConfigurationManager.AppSettings["MostPD"];
        viewcount = "3";
        clsWebShop cls = new clsWebShop();
        DataTable dt = null;
        dt = cls.Get_Most_ProductNoneProc(viewcount).Tables[0];
        if (dt.Rows.Count > 0)
        {
            string HTML = "<div id='featured'>";
            HTML += "<ul class='ui-tabs-nav' style='display:none'>";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                HTML += "<li class='ui-tabs-nav-item'  id='nav-fragment-" + i + "'><a href='#fragment-" + i + "'><img width='100px' height='100px' src='" + ResolveUrl("~/") + dt.Rows[i]["ImgUrl"].ToString() + "'><span>" + dt.Rows[i]["PDName"].ToString() + "</span></a></li>";
            }
            HTML += "</ul>";
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                HTML += "<div id='fragment-" + i + "' class='ui-tabs-panel' style=''>";
                HTML += "<img src='" + ResolveUrl("~/") + dt.Rows[i]["ImgUrl"].ToString() + "' alt='' width='175px' height='190px'  />";
                HTML += "<div class='info'>";

                HTML += "<a href='" + ResolveUrl("~/") + "Shopping/Stall/ProductDetail.aspx?PDID=" + dt.Rows[i]["PDID"].ToString() + "'>" + dt.Rows[i]["PDName"].ToString() + "</a>";
                HTML += "  </div>";
                HTML += "</div>";

            }
            HTML += "</div>";
            ltrMaster.Text = HTML;
        }
    }
}
